package org.apache.mina.example.http;

import java.net.InetSocketAddress;

import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.http.HttpClientCodec;
import org.apache.mina.transport.socket.nio.NioSocketConnector;

public class HttpCon {
	
	

	
	public static void main(String[] args) {
		NioSocketConnector connector = new NioSocketConnector();
		
		connector.getFilterChain().addLast("codec", new HttpClientCodec());
		connector.getFilterChain().addLast("logger", new  LoggingFilter());
		connector.getSessionConfig().setReadBufferSize(10*1024);
		connector.setHandler(new HttpHandler());
		ConnectFuture conn =connector.connect(new InetSocketAddress("www.baidu.com", 80));
		conn.awaitUninterruptibly();
	}
}
